<#assign sec=JspTaglibs["/WEB-INF/tags/security.tld"]>
<a href="#" id="menu-toggler"><span></span></a><!-- menu toggler -->
<div id="sidebar">
	<ul class="nav nav-list">
		<li class="active">
			<a href="${ctx}/back/main/dashboard">
				<i class="icon-dashboard"></i>
				<span>首页</span>
			</a>
		</li>
		<@sec.authorize access="hasAnyRole('ROLE_ADMIN,ROLE_MANAGER')">
		<li>
			<a href="${ctx}/back/main/ad/advertiser">
				<i class="icon-text-width"></i>
				<span>投放管理</span>
			</a>
		</li>
		</@sec.authorize>
		<@sec.authorize access="hasRole('ROLE_ADVERTISER')">
		<li>
			<a href="${ctx}/back/main/ad/target/campaign-group">
				<i class="icon-text-width"></i>
				<span>投放管理</span>
			</a>
		</li>	
		</@sec.authorize>
		<@sec.authorize access="hasAnyRole('ROLE_ADMIN,ROLE_MANAGER')">
		<li>
			<a href="${ctx}/back/main/md/audience">
				<i class="icon-desktop"></i>
				<span>媒体管理</span>
			</a>
		</li>
		</@sec.authorize>
		<@sec.authorize access="hasAnyRole('ROLE_ADMIN,ROLE_MANAGER')">
		<li>
			<a href="${ctx}/back/main/ad/usernew">
				<i class="icon-text-width"></i>
				<span>权限管理</span>
			</a>
		</li>
		</@sec.authorize>
		<@sec.authorize access="hasRole('ROLE_TRAFFICKER')">
			<li>
				<a href="${ctx}/back/main/md/media">
					<i class="icon-desktop"></i>
					<span>媒体管理</span>
				</a>
			</li>
		</@sec.authorize>
		<@sec.authorize access="hasAnyRole('ROLE_ADMIN,ROLE_MANAGER,ROLE_ADVERTISER')">
		<li>
			<a href="${ctx}/back/main/ad/ad-template">
				<i class="icon-list-alt"></i>
				<span>创意中心</span>
			</a>
		</li>
		</@sec.authorize>
		<@sec.authorize access="hasAnyRole('ROLE_ADMIN,ROLE_MANAGER,ROLE_ADVERTISER')">
		<li>
			<a href="${ctx}/back/main/ad/student">
				<i class="icon-list"></i>
				<span>学生管理</span>
			</a>
		</li>
		</@sec.authorize>
		
		<@sec.authorize access="hasAnyRole('ROLE_ADMIN,ROLE_MANAGER,ROLE_ADVERTISER')">
		<li>
			<a href="${ctx}/back/main/ad/classes">
				<i class="icon-list"></i>
				<span>班级管理</span>
			</a>
		</li>
		</@sec.authorize>
		
		<!--<li>
			<a href="#">
				<i class="icon-calendar"></i>
				<span>用户管理</span>
			</a>
		</li>-->
	</ul>
	<!--/.nav-list-->
	<div id="sidebar-collapse">
		<i class="icon-double-angle-left"></i>
	</div>
</div>
<script type="text/javascript">
$('#sidebar ul li a').click(function(){
	var _class = $(this).parent().attr('class');
	// 菜单之前没有被点击过，则执行加载
	// if (_class == undefined ||  _class.indexOf('active') < 0) {
	// 如果是首页或者跳转地址为‘#’，不做动态插入，直接重新加载整个页面。
	if ($(this).find('span').text() === '首页'
		|| $(this).attr('href')==='#') {
		return true;
	}
	
	// 选中已选择的菜单		
	$('#sidebar ul .active').removeClass('active');
	$(this).parent().addClass('active');
	
	// 加载选择页面
	$('#main-content').load($(this).attr('href'));
	// }
	return false;
});
</script>